Skip to content

GH-50689: [C++][Parquet] Add IEEE-754 total order and nan count for floating types - #50807

Open
HuaHuaY wants to merge 2 commits into
apache:mainfrom
HuaHuaY:nan_count
Open

GH-50689: [C++][Parquet] Add IEEE-754 total order and nan count for floating types#50807
HuaHuaY wants to merge 2 commits into
apache:mainfrom
HuaHuaY:nan_count

Conversation

@HuaHuaY

@HuaHuaY HuaHuaY commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Implement IEEE 754 total order and NaN counts from apache/parquet-format#514.

What changes are included in this PR?

  • Use IEEE total order by default, with a writer-level TYPE order fallback.
  • Add nan_count to statistics and nan_counts to PageIndex.
  • Preserve NaN payloads and signed zero in statistics and dictionary encoding.
  • Make Dataset pruning NaN-aware (skip FLOAT16 numeric bounds until comparison kernels are available).

Are these changes tested?

Yes.

Are there any user-facing changes?

  • cpp/src/parquet/types.h: Adds ColumnOrder::IEEE_754_TOTAL_ORDER.
  • cpp/src/parquet/properties.h: Adds the floating-point column-order writer property.
  • cpp/src/parquet/schema.h: Allows column descriptors to use IEEE-ordered min/max statistics.
  • cpp/src/parquet/page_index.h: Exposes has_nan_counts() and nan_counts().
  • cpp/src/parquet/statistics.h: Adds NaN fields and presence APIs to EncodedStatistics and Statistics, and extends encoded-state Statistics::Make / MakeStatistics overloads with nan_count and has_nan_count.

@HuaHuaY

HuaHuaY commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

There are many CI errors. I will fix them tomorrow.

@HuaHuaY
HuaHuaY force-pushed the nan_count branch 2 times, most recently from 9b4091a to 5812e60 Compare August 5, 2026 07:09
Comment thread cpp/apidoc/Doxyfile
ARROW_SUPPRESS_DEPRECATION_WARNING= \
ARROW_UNSUPPRESS_DEPRECATION_WARNING= \
GANDIVA_EXPORT= \
PARQUET_DEPRECATED(x)= \

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this because I added a PARQUET_DEPRECATED at cpp/src/parquet/statistics.h and ci failed. https://github.com/apache/arrow/actions/runs/30975844655/job/92209544482

I believe this is a long-standing issue. If someone would like me to submit a separate PR to fix it, I can certainly do so.

@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Aug 5, 2026
@HuaHuaY
HuaHuaY force-pushed the nan_count branch 2 times, most recently from bd13067 to f51ffc1 Compare August 5, 2026 08:03
Comment thread cpp/src/parquet/types.h Outdated
Comment thread cpp/src/parquet/schema.h Outdated
Comment thread cpp/src/parquet/schema.cc Outdated

int64_t null_count = 0;
int64_t distinct_count = 0;
int64_t nan_count = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest directly using std::optional<int64_t> nan_count just like is_max_value_exact and is_min_value_exact.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I choose to follow the style of null_count and distinct_count. I think there will be many diff changes to modifying them together. If we decide to do this, I recommend putting the changes in a separate PR. However, since it involves changes to a public API, we had better to put the two PRs in the same Arrow release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants